package com.hk.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.hk.dtos.BoardDTO;
import com.hk.service.BoardService;

public class BoardListController implements Controller{

	private Logger log=Logger.getLogger(this.getClass());
	private BoardService boardService;
	
	public void setBoardService(BoardService boardService) {
		this.boardService = boardService;
	}
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {

		ModelAndView mv=new ModelAndView();
		
		List<BoardDTO> list=boardService.getBoardList();
		mv.addObject("list", list);
		
		log.debug(list.size());
		
		mv.setViewName("boardList.jsp");
		
		return mv;
	}

}
